Open
Conversation
This commit adds new feature to xqueue - `lockable`. User may specify a `lock` field in fields map when doing xqueue.upgrade(). If specified xqueue checks that there is an additional index with fields (lock, status, ...). This index is used by put(), ack(), bury() and kill() methods in order to determine if current task should be locked or unlocked. This feature allows to process tasks only in a strict order or in other words, doesn't allow workers to take a task when another task by lock field is already being processed. Notable additions: * put(): When putting a task additional 1-3 queries are done to find if there is any other task in the queue with statuses L, T or R. If there is at least one task, then current task's status will be set to L rather than R. * ack(), kill(), bury(): In these methods after successful status change of task xqueue will try to find a task with L status within `lock` index and wake it up, transferring to an R state. This `lockable` feature currently cannot be used alongside with ttl or delayed features.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs to be carefully reviewed